
/*
 *  Copyright 2007 Marc Lanctot and Marc Gendron-Bellemare
 *
 *  This file is part of OpenMTG.
 *
 *  OpenMTG is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  OpenMTG is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with OpenMTG.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

public class Dealer {
  public Deck decks[];

  public Dealer(String deckFiles[]){
    decks = new Deck[2];    // hard coded for 2 players
    decks[0]=new Deck(deckFiles[0]);
    decks[1]=new Deck(deckFiles[1]);
  }

  public Card deal(int playerNum){
    Card theCard=null;
    theCard=decks[playerNum].deal();     // TODO: forget if doing this is ok..
    return theCard;
  }

  public void linearShuffle(int playerNum){
    int deckSize=decks[playerNum].size();
    for(int i=0; i<deckSize; i++){
      decks[0].swap( i, Helpers.RNG.nextInt(deckSize) );
    }
  }

  public static void linearShuffle(Deck deck) {
    int deckSize = deck.size();
    for(int i=0; i<deckSize; i++){
      deck.swap( i, Helpers.RNG.nextInt(deckSize) );
    }
  }

}
